﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            

           
            string link = "server=.;database=Students;uid=sa;pwd=123456.";
            SqlConnection connection = new SqlConnection(link);
            //向数据库插入数据
            connection.Open();
            Console.WriteLine("插入数据！");
            Console.Write("请输入姓名：");
            string  name = Console.ReadLine(); 
            Console.Write("请输入性别：");
            string  sex = Console.ReadLine();
            Console.Write("请输入年龄：");
            int age = int.Parse(Console.ReadLine());
            var sql =$"INSERT INTO [User] (Name,Sex,Age) VALUES ('{name}','{sex}','{age}')";
            SqlCommand command1 = new SqlCommand(sql, connection);
            command1.ExecuteNonQuery();
            Query query = new Query(connection);//查询数据库数据
            

        }

        
    }
}
